package com.zj.HJ;

import java.util.Scanner;
import java.util.Stack;

public class HJ31 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.nextLine();
        System.out.println(getRes(num));
    }

    public static String getRes(String num) {

        Stack<String> st = new Stack<>();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < num.length(); i++) {
            if (Character.isLetter(num.charAt(i))) {
                sb.append(num.charAt(i));
                if (i == num.length() - 1) {
                    st.push(sb.toString());
                    sb = new StringBuilder();
                }
            } else if (sb.length() > 0) {
                st.push(sb.toString());
                sb = new StringBuilder();
            }
        }
        while (!st.isEmpty()) {
            sb.append(st.pop()).append(" ");
        }
        return sb.toString().trim();
    }


}
